﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
/**
* @Author: AdinZ
* @Q  Q : 1454269
* @Email:adinz@adinz.com
* @Created: 2014/3/30 9:55:31
* */
namespace Reader.Web.api
{
    /// <summary>
    /// api 的摘要说明
    /// </summary>
    public class api : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            context.Response.Write(Api.Action.action(getRequest(context)));
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        /// <summary>
        /// 获取常用url参数
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private Dictionary<string, string> getRequest(HttpContext context)
        {
            string action = context.Request["action"];
            string type = context.Request["type"];
            string imei = context.Request["imei"];
            string version = context.Request["version"];
            string model = context.Request["model"];
            string os = context.Request["os"];
            string os_name = context.Request["os_name"];
            string screen_size = context.Request["screen_size"];
            Dictionary<string, string> dictionary = new Dictionary<string, string>();
            dictionary.Add("action", action);
            dictionary.Add("type", type);
            dictionary.Add("imei", imei);
            dictionary.Add("version", version);
            dictionary.Add("model", model);
            dictionary.Add("os", os);
            dictionary.Add("os_name", os_name);
            dictionary.Add("screen_size", screen_size);
            return dictionary;
        }








    }
}